package www.controller.member;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;

import www.member.MemberDTO;
import www.member.MemberMgr;

public class IdCheckController extends SimpleFormController {
	private MemberMgr mgr;

	public void setMgr(MemberMgr mgr) {
		this.mgr = mgr;
	}

	
	@Override
	protected ModelAndView onSubmit(HttpServletRequest request,
			HttpServletResponse response, Object command, BindException errors)
			throws Exception {
		ModelAndView mv = new ModelAndView();
		MemberDTO dto = (MemberDTO) command;
		
		boolean flag = mgr.idCheck(dto.getId());
		
		mv.addObject("flag",flag);
		mv.addObject("id",dto.getId());
		mv.setViewName(getSuccessView());
		
		
		return mv;
	}

	
	

}
